﻿using System;
using System.Windows.Controls;

using SBPweb.Modules.Smartparts;
using SBPweb.Modules.Modularity;

namespace SBPweb.Presentation.Windows.WPF.Controls
{
    public class DockedWindow : Control, ISmartpart
    {

        #region Private fields

        private bool pIsModal;
        private Aligning pAlign = Aligning.None;
        private IModule pParentModule;

        #endregion

        #region ISmartpart Members

        public Aligning Align
        {
            get
            {
                return pAlign;
            }
            set
            {
                pAlign = value;
                //Dock = AligningConverter.AligningToDockStyle(value);
            }
        }

        public IModule ParentModule
        {
            get
            {
                return pParentModule;
            }
        }

        public new bool IsVisible
        {
            get
            {
                return base.IsVisible;
            }
            set
            {
                base.Visibility = (value ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden);
                if (VisibleChanged != null)
                {
                    VisibleChanged(this, EventArgs.Empty);
                }
            }
        }

        public new bool IsEnabled
        {
            get
            {
                return base.IsEnabled;
            }
            set
            {
                base.IsEnabled = value;
                if (EnabledChanged != null)
                {
                    EnabledChanged(this, EventArgs.Empty);
                }
            }
        }

        public bool IsModal
        {
            get
            {
                return pIsModal;
            }
        }

        public event EventHandler VisibleChanged;

        public event EventHandler EnabledChanged;

        #endregion
    }
}